<?php
include_once 'quizzes/Business/user_service.php';

function checkFacebookUser($userFacebook) {
	$user =  user_service::get_user_name($userFacebook['id']);
	if(!$user){
		$user = new user(0,$userFacebook['id'],$userFacebook['id'],'','',$userFacebook['email'],'');
		$user->user_id=user_service::insert_user($user);
	}
	return $user;	
}

//function checkFacebookUser($userFaceBookId,$facebook) {
//	$user =  user_service::get_user_name($userFaceBookId);
//	if(!$user){
//		$user_info_field = array('uid','about_me','activities','affiliations','birthday',
//		'books','current_location','education_history','first_name','has_added_app',
//		'hometown_location','hs_info','interests','is_app_user','last_name',
//		'movies','music','name','pic','pic_big','pic_small',
//		'pic_square','political','profile_update_time','quotes','relationship_status',
//		'religion','sex','significant_other_id','status','timezone','tv','wall_count',
//		'work_history');
//
//		$user_facebook_info = $facebook->api_client->users_getInfo($userFaceBookId, $user_info_field);
//		//print_r($user_facebook_info);
//		$user = new user(0,$userFaceBookId,$userFaceBookId,'','','','');
//		$user->user_id=user_service::insert_user($user);
//	}
//	return $user;
//}

?>